#!/bin/bash
set -o errexit # Set the shell option to exit on error

DIRNAME=`dirname $0`
source ${DIRNAME}/action_functions.bash
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
plain='\033[0m'


function createConfig(){
  # wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh
  install ubuntu-mainline-kernel.sh /usr/local/bin/
}


function deal(){

  if [ ! -f /usr/local/bin/ubuntu-mainline-kernel.sh ] ;then
     createConfig
  fi
  version=$(ubuntu-mainline-kernel.sh -c | awk 'NR==1 {print $NF}')
  yes | sudo ubuntu-mainline-kernel.sh -i ${version}
}

function main(){
  action $0 deal
}

main $*
